<?php
namespace app\admin\controller;
use think\Request;
use think\Db;
use app\admin\model\Order as Orders;
use think\cache\driver\Redis;

class Order extends Common
{
    /**
     * @return mixed
     */
    protected $cModel;
    public function _initialize()
    {
        parent::_initialize();
        $this->cModel = new Orders;
    }
    //所有场馆列表显示
    public function index()
    {
        //查询每个场馆下的订单信息
        //首先查询场馆的信息 根据Place_id 来查询
        $dataList = $this->cModel->selectOrderList();
        // dump($dataList->toArray());die;
        $this->assign('dataList',$dataList);
        return $this->fetch();
    }
    //获取根据场馆ID 来展示所有的订单
    public function getOrderInfo($id)
    {

        $dataList = $this->cModel->getInfo();
        // dump($dataList->toArray());die;
        $this->assign('dataList', $dataList);
        return $this->fetch('order_info');
    }

    public function details($order_number)
    {
        $data = $this->cModel->getOrderDetails();
        dump($data);die;
        // $this->assign('dataList', $dataList);
        return $this->fetch('order_details');
    }




    public function delete()
    {
        if(\request()->isPost()){
            $id = input('get.id');
            $map = ['id'=>$id];
            $res = Db::name('order')->where($map)->delete();
            if($res>0){
                ajaxReturn(lang('action_success'),url('Orde/index'));
            }else{
                ajaxReturn(lang('action_error'));
            }
        }
    }


}